﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework;

using Input;
using Utils;

namespace Darwin.Source.Components.World
{
    class CEntityControllerAI : CEntityController
    {
        private double m_fAccumlatedTime;
        private double m_fSpawnTime;

        public const int MaxSpawnLimit = 1000;
        public int spawned;

        public CEntityControllerAI()
        {
            m_fAccumlatedTime = 0;
            m_fSpawnTime = 0;
            spawned = 0;
        }

        public override void Step(Darwin.Source.Components.World.Team.CTeam myTeam, GameTime gameTime)
        {
            m_fAccumlatedTime += gameTime.ElapsedGameTime.TotalSeconds;
            m_fSpawnTime += gameTime.ElapsedGameTime.TotalSeconds;

            if (m_fSpawnTime >= 0.5f && spawned < MaxSpawnLimit)
            {
                ++spawned;
                m_fSpawnTime = 0.0f;
                Vector3 pos;
                pos.X = RandomNumber.Next(-190, 190);
                pos.Y = RandomNumber.Next(0, 0);
                pos.Z = RandomNumber.Next(-190, 190);
                myTeam.SpawnEntity<Entities.MinionTypes.CSimpleMonster>(pos);
            }
        }

        public override void Draw(Darwin.Source.Components.World.Team.CTeam myTeam)
        {

        }

        public override void Draw2D(Darwin.Source.Components.World.Team.CTeam myTeam)
        {
        }
    }
}
